﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace PLCS.App.Converts
{
    public class HaveStatusToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int intValue;

            if (int.TryParse(value.ToString(), out intValue))
            {
                if (intValue == 0)
                {
                    return new SolidColorBrush(Colors.Gray);
                }
                else if (intValue == 1)
                {
                    return new SolidColorBrush(Color.FromRgb(11, 112, 253));
                }
                else if (intValue == 2)
                {
                    return new SolidColorBrush(Colors.Transparent);
                }
            }

            // 默认情况下返回透明色
            return new SolidColorBrush(Colors.Transparent);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}